package com.tanhan.mindapp.dao;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.tanhan.mindapp.dao.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.Date;

@Data
@TableName("sys_oper_log")
@Schema(description = "系统操作日志实体类")
public class SysOperLog extends BaseEntity {
    private static final long serialVersionUID = 1L;

    // 模块标题
    @TableField("title")
    @Schema(description = "模块标题", example = "用户管理")
    private String title;

    // 业务类型（0其它 1新增 2修改 3删除）
    @TableField("business_type")
    @Schema(description = "业务类型", example = "1", allowableValues = {"0", "1", "2", "3"})
    private Integer businessType;

    // 方法名称
    @TableField("method")
    @Schema(description = "方法名称", example = "com.tanhan.mindapp.controller.SysUserController.list")
    private String method;

    // 请求方式
    @TableField("request_method")
    @Schema(description = "请求方式", example = "GET")
    private String requestMethod;

    // 操作类别（0其它 1后台用户 2手机端用户）
    @TableField("operator_type")
    @Schema(description = "操作类别", example = "1", allowableValues = {"0", "1", "2"})
    private Integer operatorType;

    // 操作人员
    @TableField("oper_name")
    @Schema(description = "操作人员", example = "admin")
    private String operName;

    // 部门名称
    @TableField("dept_name")
    @Schema(description = "部门名称", example = "研发部")
    private String deptName;

    // 请求URL
    @TableField("oper_url")
    @Schema(description = "请求URL", example = "/admin/system/user/list")
    private String operUrl;

    // 主机地址
    @TableField("oper_ip")
    @Schema(description = "主机地址", example = "192.168.1.100")
    private String operIp;

    // 操作地点
    @TableField("oper_location")
    @Schema(description = "操作地点", example = "北京")
    private String operLocation;

    // 请求参数
    @TableField("oper_param")
    @Schema(description = "请求参数", example = "{\"name\":\"张三\",\"status\":\"0\"}")
    private String operParam;

    // 返回参数
    @TableField("json_result")
    @Schema(description = "返回参数", example = "{\"code\":200,\"msg\":\"操作成功\"}")
    private String jsonResult;

    // 操作状态（0正常 1异常）
    @TableField("status")
    @Schema(description = "操作状态", example = "0", allowableValues = {"0", "1"})
    private Integer status;

    // 错误消息
    @TableField("error_msg")
    @Schema(description = "错误消息", example = "")
    private String errorMsg;

    // 操作时间
    @TableField("oper_time")
    @Schema(description = "操作时间", example = "2023-01-01 12:00:00")
    private Date operTime;
}
